﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using SmartSpace.Core;

namespace SmartSpace.UI.Silverlight.Web.Handlers
{
    /// <summary>
    /// Summary description for Res
    /// </summary>
    public class Res : IHttpHandler
    {
        public void ProcessRequest(HttpContext context)
        {
            Guid id = new Guid(context.Request.QueryString["id"]);
            ICoreService service = Global.Get<ICoreService>();
            SmartSpace.Core.Application application = service.FindApplication(id);
            if (application != null)
            {
                context.Response.ContentType = "image/JPEG";
                context.Response.BinaryWrite(application.Logo);
            }
            else
            {
            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}